package club.beimeng.msmservice.service.impl;

import club.beimeng.msmservice.email.EmailSender;
import club.beimeng.msmservice.email.template.entity.SendCode;
import club.beimeng.msmservice.service.MsmService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;

@Service
public class MsmServiceImpl implements MsmService {

    @Autowired
    private EmailSender emailSender;

    @Override
    public boolean sendEmail(HashMap<String, Object> param, String email) {
        try {
            SendCode sendCode = new SendCode();
            sendCode.setCode((String) param.get("code"));
            sendCode.setFrom("Mr.Bao");
            sendCode.setUsername("用户");
            sendCode.setTitle("请接受您的验证码");
            emailSender.sendCode(sendCode,email);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return true;
    }
}
/*
 *
 * @author Mr.Bao
 * @date 2021/8/2 16:35
 */